$('div.btn-group-vertical > a.btn-default').click(function () {
    if ($(this).hasClass('btn-primary')) {
        $(this).removeClass('btn-primary');
        $(this).addClass('btn-default');
    }
    else {
        $(this).siblings().removeClass('btn-primary');
        $(this).removeClass('btn-default');
        $(this).addClass('btn-primary');
    }
})
$("body").on("click", ".btn-group-sub>a", function () {
    if (!$(this).hasClass("rectangle-top")) {
        $(this).siblings('a').removeClass('rectangle-top');
        $(this).addClass('rectangle-top');
    }
});
$("body").on("click", "ul.navinnav >li>a", function () {
    if (!$(this).hasClass("select")) {
        var ul = $(this).parent().parent();
        ul.find("a").removeClass('select');
        $(this).addClass('select');
    }
});
$("body").on("click", "ul.navasp >li>a", function () {
    if ($(this).children("p").children("i").hasClass("fa-plus")) {
        $(this).children("p").children("i").removeClass("fa-plus").addClass("fa-minus");
    }
    else if ($(this).children("p").children("i").hasClass("fa-minus")) {
        $(this).children("p").children("i").removeClass("fa-minus").addClass("fa-plus");
    }
    else if ($(this).children("p").children("i").hasClass("fa-caret-right")) {
        $(this).children("p").children("i").removeClass("fa-caret-right").addClass("fa-caret-down");
    }
    else if ($(this).children("p").children("i").hasClass("fa-caret-down")) {
        $(this).children("p").children("i").removeClass("fa-caret-down").addClass("fa-caret-right");
    }
});
$("body").on("click", "ul.navinnav >li>a", function () {
    if ($(this).children("p").children("i").hasClass("fa-plus")) {
        $(this).children("p").children("i").removeClass("fa-plus").addClass("fa-minus");
    }
    else if ($(this).children("p").children("i").hasClass("fa-minus")) {
        $(this).children("p").children("i").removeClass("fa-minus").addClass("fa-plus");
    }
    else if ($(this).children("p").children("i").hasClass("fa-caret-right")) {
        $(this).children("p").children("i").removeClass("fa-caret-right").addClass("fa-caret-down");
    }
    else if ($(this).children("p").children("i").hasClass("fa-caret-down")) {
        $(this).children("p").children("i").removeClass("fa-caret-down").addClass("fa-caret-right");
    }
});
//初始化地图对象，加载地图

var vo=new Vue({
    el:"#tab",
    data:{
        areaList:{areaList:[],carList:[]},
        time:{startTime:"",endTime:""},
        device:{location:[],marker:null},
        jsession: null,
        isInitFinished: false,
        swfwidth: 0,//swf插件窗口宽度
        swfheight: 0,//swf 插件窗口高度
        chnCount: 4,//默认通道数
        serverIp: "",//请求的服务器ip
        serverPort: "",//请求的服务器端口
        isLoadLoginServer: false,
        fileList: []
    },
    methods:{
        selectProjectList:function (data) {
            $.ajax({
                type: "GET",
                url:  baseURL + 'xinpai/project/list',
                contentType: "application/json",
                data: data,
                success: function(r){
                    if(r.code === 0){
                            va.areaList.areaList=r.list;
                            va.$nextTick(function () {
                                $('.collapse').collapse('hide');
                            })
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        selectCarList:function (data) {
            $.ajax({
                type: "GET",
                url:  baseURL + 'xinpai/car/select',
                contentType: "application/json",
                data: data,
                success: function(r){
                    if(r.code === 0){
                        va.areaList.carList=r.list;
                    }else{
                        alert(r.msg);
                    }
                }
            });
        },
        show(vid,id){

        }
    },
    created(){
        this.selectProjectList({parentId:GetRequest().pid,type:1});
        this.selectCarList({nexus:'true',project_id:GetRequest().pid});
        //十分秒年月日范围，限制开始结束相隔天数小于30天

    }
})
